package top.ninwoo.edgecenter.service;

import top.ninwoo.common.entity.ClusterConfig;
import top.ninwoo.common.entity.NetworkTopology;

import java.util.List;

/**
 * @Author joliu
 * @Description Topo服务
 * @Date　Create in 上午10:55 2019/11/7
 */
public interface TopologyService {

    /**
     * 初始化网络拓扑
     * 将集群中的网络拓扑构建
     * @param clusterConfig
     */
    void initTopo(ClusterConfig clusterConfig);

    void createTopo(long clusterId, NetworkTopology topology);

    boolean forwardTraffic(String containerId1, String containerId2, int port);

    NetworkTopology getTopology(Long clusterId);

    void createLinkForNewer(Long clusterId, String appName, String containerId);

    // 调整网络拓扑，这里限定条件为，网络节点不改变
    String modifyTopology(long clusterId, NetworkTopology topology);

    void removeTopoByCluterId(long clusterId);

    void dropDockerNetwork(long clusterId, String appName, List<String> ipList);

    void cancelDropDockerNetwork(long clusterId, String appName, List<String> ipList);
}
